package com.heima.search.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.search.dtos.HistorySearchDto;
import com.heima.search.service.IHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/history")
public class HistoryController {

    @Autowired
    private IHistoryService historyService;

    /**
     * 加载历史记录列表
     * @return
     */
    @PostMapping("/load")
    public ResponseResult list(){
        return historyService.list();
    }

    /**
     * 删除
     * @return
     */
    @PostMapping("/del")
    public ResponseResult removeHistory(@RequestBody HistorySearchDto dto){
        return historyService.removeHistory(dto);
    }
}
